// 获取
import request from '@/utils/request'
export const getSettingAPI = (query) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: query
  })
}
// 添加
export const addSettingAPI = (data) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data
  })
}
// 删除
export const delSettingAPI = (id) => {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}
/**
 * 根据 id 获取角色详情, 用于回显
 * **/
export function reqGetRoleDetail(id) {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}
// 编辑
export const dirSettingAPI = (settingsObj) => {
  return request({
    method: 'put',
    url: `/sys/role/${settingsObj.id}`,
    data: settingsObj
  })
}
// 查询企业
export const getComAPI = (id) => {
  return request({
    url: `/company/${id}`,
    method: 'get'
  })
}
// 分配权限给角色
export const assignAPI = (id, permIds) => {
  return request({
    url: `/sys/role/assignPrem`,
    method: 'put',
    data: {
      id, permIds
    }
  })
}
